//// 检查是否为当前周的周二
// console.log("Is current week's Tuesday?", isTuesday(date));
//
// // 检查是否为下周的周二
// console.log("Is next week's Tuesday?", isTuesday(date, 1));
//
// // 检查是否为下下周的周二
// console.log("Is following week's Tuesday?", isTuesday(date, 2));
function isTuesdayOfWeek(date, weekDifference) {
    var inputDate = new Date(date);
    var today = new Date();
    today.setHours(0, 0, 0, 0);

    // Check if input date is a Tuesday
    if (inputDate.getDay() !== 2) {
        return false;
    }

    // Calculate the start of this week
    var startOfWeek = new Date(today);
    startOfWeek.setDate(today.getDate() - today.getDay() + 2); // +2 because Tuesday is the second day of the week

    // Calculate the start of the week after adding the weekDifference
    var startOfWeekWithDifference = new Date(startOfWeek);
    startOfWeekWithDifference.setDate(startOfWeek.getDate() + (7 * weekDifference));

    // Check if input date is in the week of startOfWeekWithDifference
    if (inputDate >= startOfWeekWithDifference && inputDate < new Date(startOfWeekWithDifference).setDate(startOfWeekWithDifference.getDate() + 7)) {
        return true;
    }

    return false;
}
